<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>拉拉货物流有限公司</title>
		<meta name="keywords" content="拉拉货物流有限公司,汕头物流配送,汕头物流,汕头物流货运,汕头货运,全国货运,厦门物流配送,深圳物流配送,广州物流配送,物流配送,物流货运,货运配送" />
	    <meta name="description" content="拉拉货物流有限公司是一家承接全国各地门到门配送业务的专业第三方物流，为企业量身定做仓储、配送物流方案，针对大小客户配备专业项目小组进行专人专车对接。" />
	    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	    <link rel="stylesheet" href="css/amazeui.min.css" type="text/css" />
	    <link rel="stylesheet" href="css/style.css" type="text/css" />
		<link rel="stylesheet" href="layui/css/layui.css">
	    <script type="text/javascript" src="js/jquery.min.js" ></script>
	    <script type="text/javascript" src="js/amazeui.min.js" ></script>
		<script src="layui/layui.js"></script>
	</head>
	<body class="bgcolor">
		<header data-am-widget="header" class="am-header am-header-default header-green1">
	      <div class="am-header-left am-header-nav ">
		        <a href="javascript:history.back()" style="color: #fff;"><i class="am-icon-chevron-left"></i></a>
	        </div>
		  <h1 class="am-header-title" style="color: #fff;">支付</h1>
        </header>
        <div class="jl"></div>
        <h2 class="pay">预支付金额：<span id="pay">￥100</span></h2>
        <ul class="pay-style">
        	<li>
        		<label class="am-radio-inline">
				    <input type="radio" id="zhye" name="radio10" value="1" data-am-ucheck="" class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
				</label>
				<img src="images/ye.jpg" width="25">
				<span id="zh">账户余额（5.20元）</span>
        	</li>
        	<li>
        		<label class="am-radio-inline">
				    <input type="radio" id="wx"  name="radio10" value="2" data-am-ucheck="" class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
				</label>
				<img src="images/wx.jpg" width="25">
				<span>微信支付</span>
        	</li>
        	<li>
        		<label class="am-radio-inline">
				    <input type="radio"  id="zhb" name="radio10" value="3" data-am-ucheck="" class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
				</label>
				<img src="images/zfb.jpg" width="25">
				<span>支付宝支付</span>
        	</li>
        	<li>
        		<label class="am-radio-inline">
				    <input type="radio"  id="yl"  name="radio10" value="4" data-am-ucheck="" class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span>
				</label>
				<img src="images/yl.png" width="25">
				<span>银联在线支付</span>
        	</li>
        </ul>
        <button class="save" type="button">确认支付</button>
        
	</body>
	<script type="text/javascript">
		layui.use(['jquery','layer'],function(){
			     var layer=layui.layer
			      var order=JSON.parse(sessionStorage.getItem("order"))
				  var url=JSON.parse(sessionStorage.getItem("url"))
				  var user=JSON.parse(sessionStorage.getItem("user"))
				  var message=JSON.parse(sessionStorage.getItem("message"))
				  var moneyId=sessionStorage.getItem("moneyId")
				  var paymoney=0
				  if(message.money!=null){
					   $("#zh").html('账户余额'+'('+message.money+'元)')
				  }else{
					   $("#zh").html('账户余额(0元)')
				  }
				 
				  console.log(moneyId)
				 $.ajax({
					 url:url+'/clientOrder/money?id='+moneyId,
				 	dataType:'json',//服务器返回json格式数据
				 	type:'get',//HTTP请求类型
				 	timeout:10000,//超时时间设置为10秒；
				 	success:function(r){
						paymoney=r.data
				 		$("#pay").html('￥'+ r.data+'元')
				 	},
				 	error:function(xhr,type,errorThrown){
				 		
				 	}
				 });
				 
				 $(".save").click(function(){
					
					  var ck= $(":checked")
					
					 
					 if(ck.val()=='1'){
						 console.log("aaa")
						 if(message.money<paymoney){
							 alert("可用余额不足")
							 return false
						 }
						 
						 $.ajax({
							 url:url+'/bank/blpay?userId='+user.id+'&money='+paymoney,
						 	dataType:'json',//服务器返回json格式数据
						 	type:'get',//HTTP请求类型
						 	timeout:10000,//超时时间设置为10秒；
						 	success:function(r){
						 		if(r.code==200){
									$.ajax({
										url:url+'/clientOrder/pay?id='+moneyId,
										dataType:'json',//服务器返回json格式数据
										type:'get',//HTTP请求类型
										timeout:10000,//超时时间设置为10秒；
										success:function(r){
											alert("支付成功（订单信息请到个人中心查看）")
																sessionStorage.removeItem("distance")
																sessionStorage.removeItem("orderadd")
																sessionStorage.removeItem("qidian")
																sessionStorage.removeItem("zhongdian")
																sessionStorage.removeItem("moneyId")
														location.href='index2.html'
																	
																
										}
									
								})
						 	}
							}
				
						 });
						 
						
						 
						 
						 
					 }
					 if(ck.val()=='2'){
					 						 
					 						 
					 }
					 if(ck.val()=='3'){
					 		location.href=url+"/price/alipay?price="+paymoney;				 
					 						 
					 }
					 if(ck.val()=='4'){
					 						 
					 						 
					 }
					 
					 
					 
					 
				 })
			
			
			
			
			
		})
	</script>
</html>
